package cn.tedu.tnt_sky.service.Impl;


import cn.tedu.tnt_sky.common.result.PageResult;
import cn.tedu.tnt_sky.mapper.FeedbacksMapper;
import cn.tedu.tnt_sky.pojo.dto.FeedbacksListPageDTO;
import cn.tedu.tnt_sky.pojo.dto.FeedbacksStatusDTO;
import cn.tedu.tnt_sky.pojo.vo.FeedbacksListVO;
import cn.tedu.tnt_sky.service.FeedbacksService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 17975
* @description 针对表【feedbacks】的数据库操作Service实现
* @createDate 2023-08-19 13:17:07
*/
@Service
public class FeedbacksServiceImpl implements FeedbacksService{
    @Autowired
    FeedbacksMapper feedbacksMapper;

    /**
     * 查询反馈列表
     * @return
     */
    @Override
    public PageResult getFeedbacksList(FeedbacksListPageDTO feedbacksListPageDTO) {
        PageHelper.startPage(feedbacksListPageDTO.getPage(),feedbacksListPageDTO.getPageSize());
        Page<FeedbacksListVO> feedbacksListPage = feedbacksMapper.getAllFeedbacks();
        return new PageResult(feedbacksListPage.getTotal(),feedbacksListPage.getResult());
    }

    /**
     * 修改状态
     * @param feedbacksStatusDTO
     */
    @Override
    public void updateFeedbackStatus(FeedbacksStatusDTO feedbacksStatusDTO) {
        feedbacksMapper.updateFeedbackStatus(feedbacksStatusDTO);
    }

    /**
     * 删除反馈
     * @param id
     */
    @Override
    public void deleteFeedback(long id) {
        feedbacksMapper.deleteFeedback(id);
    }
}
